//
//  DetailCommentCell.m
//  ShangHaiTuJI
//
//  Created by xiaoxiangtuji on 2017/9/1.
//  Copyright © 2017年 xiaoxiangtuji. All rights reserved.
//

#import "DetailCommentCell.h"

@implementation DetailCommentCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setSubViews];
    }
    return self;
}

/**
 页面布局的设置
 */
-(void)setSubViews{
    UIImageView *iconImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:iconImageView];
    [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).offset(scaleLeftAndRight(10));
        make.top.equalTo(self.contentView.mas_top).offset(scaleTopAndBottom(10));
        make.size.mas_equalTo(CGSizeMake(40, 40));
    }];
    UILabel *nameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(iconImageView.mas_right).offset(scaleLeftAndRight(5));
        make.top.equalTo(self.contentView.mas_top).offset(scaleTopAndBottom(15));
        make.height.mas_equalTo(scaleTopAndBottom(20));
        make.right.equalTo(self.contentView);
    }];
    UIButton *praiseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView addSubview:praiseBtn];
    [praiseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView.mas_bottom).offset(scaleTopAndBottom(-10));
        make.left.equalTo(iconImageView.mas_right).offset(scaleLeftAndRight(5));
        make.height.mas_equalTo(scaleTopAndBottom(20));
        make.width.mas_equalTo(scaleLeftAndRight(60));
    }];
    UIButton *replyBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView addSubview:replyBtn];
    [replyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView.mas_bottom).offset(scaleTopAndBottom(-10));
        make.left.equalTo(praiseBtn.mas_right).offset(scaleLeftAndRight(5));
        make.width.mas_equalTo(scaleLeftAndRight(60));
        make.height.mas_equalTo(scaleTopAndBottom(20));
    }];
    UILabel *timeLabel = [[UILabel alloc] init];
    [self.contentView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView.mas_bottom).offset(scaleTopAndBottom(-10));
        make.width.mas_equalTo(scaleLeftAndRight(100));
        make.height.mas_equalTo(scaleTopAndBottom(20));
        make.right.equalTo(self.contentView);
    }];
    UILabel *commentLabel = [[UILabel alloc] init];
    [self.contentView addSubview:commentLabel];
    [commentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(iconImageView.mas_right).offset(scaleLeftAndRight(5));
        make.top.equalTo(nameLabel.mas_bottom).offset(scaleTopAndBottom(5));
        make.bottom.equalTo(praiseBtn.mas_top).offset(scaleTopAndBottom(-5));
        make.right.equalTo(self.contentView.mas_right).offset(scaleLeftAndRight(-10));
    }];
    iconImageView.backgroundColor = [UIColor redColor];
    nameLabel.text = @"呜呜呜啦啦";
    commentLabel.text = @"发哈康师傅哈康师傅撒身份half哈回复你擦拭";
    praiseBtn.backgroundColor = [UIColor cyanColor];
    replyBtn.backgroundColor = [UIColor cyanColor];
    timeLabel.text = @"8小时前";
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
